using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AudioManager : MonoBehaviour
{
    public static AudioManager Instance { get; private set; }
    public AudioSource audioSource;
    private void Awake()
    {
        Instance = this;
        audioSource = GetComponent<AudioSource>();
    }
    public void PlayBgm(string path)
    {
        AudioClip ac = Resources.Load<AudioClip>(path);
        audioSource.clip = ac;
        audioSource.Play();
    }
    public void PlayClip(string path,float volume=1.0f)
    {
        AudioClip ac = Resources.Load<AudioClip>(path);
        AudioSource.PlayClipAtPoint(ac,transform.position, volume);
        audioSource.clip = ac;
        audioSource.Play();
    }
    // Start is called before the first frame update
    void Start()
    {
        //PlayBgm(Config.bgm1);
    }

    // Update is called once per frame
    void Update()
    {

    }
}
